﻿<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link type="text/css" rel="stylesheet" href="/Static/js/layer/need/layer.css" />
    <link type="text/css" rel="stylesheet" href="/Static/js/layui/css/layui.css" />
    <link type="text/css" rel="stylesheet" href="/Static/styles/font-awesome.min.css">
    <link type="text/css" rel="stylesheet" href="/Static/styles/bootstrap.min.css">
    <link type="text/css" rel="stylesheet" href="/Static/styles/main.css">
    <script src="/Static/js/jquery/jquery-1.11.1.min.js"></script>
    <script src="/Static/script/bootstrap-hover-dropdown.js"></script>
    <script src="/Static/js/layui/layui.js"></script>
    <style>
        html {
            overflow: hidden;
        }

        .copyright {
            position: fixed;
            bottom: 10px;
        }

        .left-menu-bg-color {
            background-color: #EEEEEE!important;
        }

        .left-menu-item-bg {
            background-color: #EEEEEE !important;
            border-bottom: 1px solid rgba(72,72,72,0.2) !important;
            padding-bottom
        }

        .nav > li > a {
            color: #9A9A9A!important;
        }
    </style>
</head>
<body>
    <div id="header-topbar-option-demo" class="page-header-topbar">
        <nav id="topbar" role="navigation" style="margin-bottom: 0;" data-step="3" class="navbar navbar-default navbar-static-top">
            <div class="topbar-main">
                <div style="text-align:left;display:inline-block;">
                    <img src="~/Static/images/login/logo.png" width="110px" />
                </div>
                <ul class="nav navbar navbar-top-links navbar-right mbn">
                    <li class="dropdown topbar-user">
                        <a data-hover="dropdown" href="#" class="dropdown-toggle"><img src="~/Static/images/avatar/profile-pic.png" alt="" class="img-responsive img-circle" />&nbsp;<span class="hidden-xs">@ViewBag.RealName</span>&nbsp;<span class="caret"></span></a>
                        <ul class="dropdown-menu dropdown-user pull-right">
                            <li><a href="#" onclick="userManager(this)" data-src="/Sys_User/MyInfo"><i class="fa fa-user"></i>个人信息</a></li>
                            <li><a href="#" onclick="userManager(this)" data-src="/Sys_User/UpdatePwd"><i class="fa fa-calendar"></i>修改密码</a></li>
                            <li class="divider"></li>
                            <li><a href="/Login/Login_Out"><i class="fa fa-key"></i>退出登录</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </nav>

    </div>
    <div id="wrapper" class="left-menu-bg-color" style="width:150px;display:inline-block;">
        <!--BEGIN SIDEBAR MENU-->
        <nav id="sidebar" role="navigation" style="width:150px;height:93.5%"
             data-position="right" class="navbar-default navbar-static-side left-menu-bg-color">
            <div class="sidebar-collapse menu-scroll left-menu-bg-color">
                <ul id="side-menu" class="nav">
                    <div class="clearfix"></div>
                </ul>
            </div>
                <div class="copyright">
                    <p>Collect from <a href="http://www.aioae.com/" title="指效OA" target="_blank">指效OA</a></p>
                </div>
        </nav>
        <!--END SIDEBAR MENU-->,
    </div>
    <div id="page-wrappers" style="float:right;display:inline-block;">
        <div id="iframe-box">
            <iframe id="mainFrame" frameborder="0" allowtransparency="true" scrolling="auto" width="100%" height="100%"></iframe>
        </div>
    </div>
    <input type="hidden" id="LeftMenuList" value="@ViewBag.LeftMenuList" />
    <script>
        //生成左侧菜单栏
        $(document).ready(function () {
            var leftData = eval("(" + $("#LeftMenuList").val() + ")");
            var leftUL = $('#side-menu');
            for (var i in leftData) {
                leftUL.append('<li class="left-menu-item-bg" onclick="setFramesrc(this);" data-src="' + leftData[i].url + '"><a href="javascript:void(0)"><i class="' + getCss(leftData[i].name) + '"></i><span class="menu-title">' + leftData[i].name + '</span></a></li>');
            }

            //设置iframe高度和宽度
            iframeHeight();
        });
        //给根据浏览器像素iframe添加一个固定的高度
        function iframeHeight() {
            var height = $(window).height();
            var width = $(window).width();
            height = height - $("#header-topbar-option-demo").height();
            width = width - $("#wrapper").width();
            $("#iframe-box").css({ "height": height, "width": width });
        }
        //返回各菜单栏图标样式
        function getCss(title) {
            var cssStr = 'fa fa-tachometer fa-fw ';
            switch (title) {
                case '企业架构': cssStr = 'fa fa-tachometer fa-fw'; break;
                case '项目管理': cssStr = 'fa fa-desktop fa-fw'; break;
                case '资产管理': cssStr = 'fa fa-edit fa-fw'; break;
                case '临时任务': cssStr = 'fa fa-send-o fa-fw'; break;
                case '审批管理': cssStr = 'fa fa-th-list fa-fw'; break;
                case '我的申请单': cssStr = 'fa fa-database fa-fw'; break;
                case '文件系统': cssStr = 'fa fa-file-o fa-fw'; break;
                case '个人空间': cssStr = 'fa fa-gift fa-fw'; break;
                case '统计': cssStr = 'fa fa-sitemap fa-fw'; break;
                case '系统设置': cssStr = 'fa fa-envelope-o'; break;
                case '使用手册': cssStr = 'fa fa-bar-chart-o fa-fw'; break;
            }
            return cssStr;
        }
        //设定iframe链接
        function setFramesrc(doc) {
            var url = $(doc).attr('data-src');
            $('#mainFrame').attr('src', url);
            var href = window.location.href;
            window.location.href = href.substr(0, href.indexOf('#')) + '#' + url;
            return false;
        }
        //设定页面加载时iframe的src
        window.onload = function(){
            var href = window.location.href;
            var url = '@ViewBag.HomeManu.MUrl' + "?mid=" + '@ViewBag.HomeManu.Id';//默认首页
            if (href.indexOf('#') != -1) {
                url = href.substr(href.indexOf('#') + 1);
            }
            $('#mainFrame').attr('src', url);
        }


        function userManager(obj) {
            var href = window.location.href;
            var url = $(obj).attr("data-src");
            if (href.indexOf('#') != -1) {
                url = href.substr(href.indexOf('#') + 1);
            }
            $('#mainFrame').attr('src', url);
        }
    </script>
</body>
</html>
